<!DOCTYPE HTML>
<html>
<head>
    <title>hhh</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="/js/jquery.min.js"></script>
    <script src="/js/jQuery.md5.js"></script>
    <script src="/js/common.js"></script>

</head>
<script>

    function login() {
        var username = $("#username").val();
        var password = $("#password").val();
        if (username.length == 0) {
            //  alert('请输入用户名');
            $("#alert1").show() ;
            $("#alert").html('请输入名') ;
            return false;
        }
        if (password.length == 0) {
            $('#alert1').show() ;
            $('#alert').html('请输入') ;
            return false;
        }

        $.ajax({
            type: "get",
            url: "/tianj/",
            data: "p=" +password + "&u=" + username + "&time=" + new Date(),
            success: function (result) {
                if (result != "1") {

                    window.location.href = "/selects/"
                    return false;
                }
                else {
                    $("#alert1").show() ;
                    $("#alert").html('添加失败 ') ;
                    return false;

                }
            }
        });

    }
    document.onkeydown = function (e) {
        if (!e) e = window.event;
        if ((e.keyCode || e.which) == 13) {
            $(".btn").click();
        }
    }

</script>
<body>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="navbar-inner">
            <div class="container">
                <div class="span12">
                </div>
            </div>
        </div>
    </div>



    <div class="container-fluid">
        <div class="row-fluid">


            <div class="span12">
            </div>

        </div>

        <div class="container-fluid" style="display:none" id="alert1">

            <div class="row-fluid">
                <div class="span12">
                    <div class="alert alert-error">

                        <h4>
                            提示!
                        </h4> <strong>警告!</strong><div id="alert" ></div>
                    </div>
                </div>
            </div>
        </div>
        <!--中部-->
        <div class="container-fluid" role="navigation">
            <div class="row-fluid">

                <div class="span12">书写日志


                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span2"><p class="text-left">
                                    标题: </p></div>
                            <div class="span10"><input type="text" class="search-query" placeholder="请输入标题名" id="username"/>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span2"><p class="text-left">
                                    内容: </p></div>
                            <div class="span10">


                                <textarea  class="search-query" clos="20" rows="5" id="password" ></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span12">
                            <a class="btn" onclick="login()" href="#">添加</a>
                        </div>
                    </div>


                </div>
            </div>
        </div>

        <!--中部-->


    </div>

</body>
</html>